<template>
	<div class="content">
        <post title="1、主页" :param=index ></post>
        <post title="2、登陆" :param=login ></post>
        <post title="3、登出" :param=logout ></post>
        <post title="4、注册短信验证码" :param=regSmscode ></post>
        <post title="5、注册" :param=register ></post>
        <post title="6、找回密码短信验证码" :param=findpassSmscode ></post>
        <post title="7、找回密码" :param=findpass ></post>
        <post title="8、公告列表" :param=notice ></post>
        <post title="9、公告详情" :param=noticeDetails ></post>
        <post title="10、投标推荐" :param=investmentRecommend ></post>
        <post title="11、投标专区筛选条件" :param=investmentCondition ></post>
        <post title="12、投标专区" :param=investment ></post>
        <post title="13、投标详情" :param=investmentDetails ></post>
        <post title="14、投标详情-投标描述" :param=investmentDescition ></post>
        <post title="15、投标详情-借款方信息" :param=investmentBorrower ></post>
        <post title="16、投标详情-材料公示" :param=investmentImg ></post>
        <post title="17、投标详情-风险控制" :param=investmentRisk ></post>
        <post title="18、投标详情-担保公司" :param=investmentDb ></post>
        <post title="19、投标详情-投标列表" :param=investmentInvest ></post>
        <post title="20、计算收益" :param=calculateInvest ></post>
        <post title="21、代金券" :param=getUccoupon ></post>
        <post title="22、加息券" :param=getReward ></post>
        <post title="23、投标" :param=tenderAction ></post>
        <post title="24、投资协议" :param=investAgreement ></post>
        <post title="25、用户信息" :param=userCenter ></post>
        <post title="26、修改登录密码手机短信验证码" :param=getResetPasswordSmsCode ></post>
        <post title="27、修改登录密码" :param=resetPassword ></post>
        <post title="28、设置交易密码" :param=setTradepwd ></post>
        <post title="29、修改交易密码手机短信验证码" :param=getResetTradepwdSmsCode ></post>
        <post title="30、修改交易密码" :param=resetTradepwd ></post>
        <post title="31、实名认证" :param=certifyid ></post>
        <post title="32、认证状态" :param=userStatus ></post>
        <post title="33、更换手机短信验证码(旧手机)" :param=getModifyMobileSmsCodeOldphone ></post>
        <post title="34、修改手机(验证旧手机)" :param=modifyMobileVerifyOldphone ></post>
        <post title="35、更换手机短信验证码" :param=getModifyMobileSmsCode ></post>
        <post title="36、修改手机" :param=modifyMobile ></post>
        <post title="37、银行列表" :param=getBank ></post>
        <post title="38、银行卡管理" :param=bankmg ></post>
        <post title="39、添加银行卡" :param=bankAction ></post>
        <post title="40、设置默认银行卡" :param=changeBankUse ></post>
        <post title="41、删除银行卡" :param=deleteBank ></post>
        <post title="42、我的礼券" :param=reward ></post>
        <post title="43、我的礼券-代金券详情" :param=rewardDjqDetails ></post>
        <post title="44、我的礼券-加息券详情" :param=rewardJxqDetails ></post>
        <post title="45、我的礼券-红包详情" :param=rewardHbDetails ></post>
        <post title="46、资金记录" :param=fundrecord ></post>
        <post title="47、收益概况" :param=income ></post>
        <post title="48、消息管理" :param=msg ></post>
        <post title="49、消息阅读(无法使用)" :param=msgRead ></post>
        <post title="50、邀请好友信息" :param=fcode ></post>
        <post title="51、邀请好友二维码内容" :param=fcodeUrl ></post>
        <post title="52、我的奖励" :param=fcodeReward ></post>
        <post title="53、回款记录" :param=repayment ></post>
        <post title="54、我的投资" :param=myinvest ></post>
        <post title="55、我的投资-详细" :param=myinvestDetails ></post>
        <post title="56、提现" :param=withdrawals ></post>
        <post title="57、提现处理" :param=withdrawalsAction ></post>
        <post title="58、提现处理中" :param=withdrawalsProcessing ></post>
        <post title="59、撤销提现申请" :param=withdrawalsCancel ></post>
        <post title="60、充值" :param=charge ></post>
        <post title="61、银联支付" :param=unionpay ></post>
        <post title="62、银联支付后台通知" :param=BackReceive ></post>
        <post title="63、升级" :param=upgrade ></post>
        <post title="64、债权超市筛选条件" :param=transferCondition ></post>
        <post title="65、债权超市" :param=transfer ></post>
        <post title="66、债权转让详细" :param=transferDetails ></post>
        <post title="67、债权转让专题介绍" :param=transferIntr ></post>
        <post title="68、债权转让还款计划" :param=transferRepayment ></post>
        <post title="69、债权投标" :param=transferAction ></post>
        <post title="70、投资还款计划" :param=investmentRepaymentplan ></post>
        <post title="71、发布债权" :param=mytransferAction ></post>
        <post title="72、我的债权" :param=mytransfer ></post>
        <post title="73、债权详情" :param=mytransferDetail ></post>
        <post title="2、登陆" :param=login ></post>
        
	</div>
</template>

<script>
    import md5 from 'js-md5';
    import post from 'components/testpost.vue';
    export default {
    	data(){
            return{
            	index:{
                    url:'/api/index'
                },
            	login:{
                    url:'/api/login',
                    value:{
                        account:'',
                        password:''
                    }
                },
                logout:{
                    url:'/api/logout',
                    value:{
                        token:''
                    }
                    
                },
                regSmscode:{
                    url:'/api/get_reg_sms_code',
                    value:{
                        phone:''
                    }
                    
                },
                register:{
                    url:'/api/register',
                    value:{
                        phone:'',
                        password:'',
                        password_confirm:'',
                        sms_code:'',
                        recommend:'',
                        agreement:''
                    },
                    beizhu:[
                        {'line':'code0返回msg的内容'},
                        {'line':'code1返回msg的内容和跳转注册成功'}
                    ]
                    
                },
                findpassSmscode:{
                    url:'/api/get_findpass_sms_code',
                    value:{
                        phone:''
                    },
                },
                findpass:{
                    url:'/api/findpass',
                    value:{
                        phone:'',
                        password:'',
                        sms_code:''
                    },
                },
                notice:{
                    url:'/api/notice'
                },
                noticeDetails:{
                    url:'/api/notice_details',
                    value:{
                        a_id:''
                    }
                },
                investmentRecommend:{
                    url:'/api/investment_recommend',
                    beizhu:[{line:'返回巨量数据'}]
                },
                investmentCondition:{
                    url:'/api/investment_condition',
                    beizhu:[{line:'分类信息获取'}]
                },
                investment:{
                    url:'/api/investment',
                    value:{
                        limit:'',
                        offset:'',
                        bt_code:'',
                        pubtime:'',
                        rate:'',
                        pub_sort:'',
                        loantime_sort:'',
                        rate_sort:''
                    },
                    beizhu:[
                        {line:'limit获取数据条数，通常10条'},
                        {line:'offset数据页数，加载完一页后+1，返回data没数据时不再增加'},
                        {line:'bt_code标分类信息，可通过investment_condition获得'},
                        {line:'pubtime发布时间1-6六个类别发布时间，可通过investment_condition获得'},
                        {line:'rate利率1-4个类别，可通过investment_condition获得'},
                    ]
                },
                investmentDetails:{
                    url:'/api/investment_details',
                    value:{
                        b_id:''
                    },
                    beizhu:[
                        {line:'b_id指项目id号'}
                    ]
                },
                investmentDescition:{
                    url:'/api/investment_descition',
                    value:{
                        b_id:'',
                        token:''
                    }
                },
                investmentBorrower:{
                    url:'/api/investment_borrower',
                    value:{
                        b_id:''
                    }
                },
                investmentImg:{
                    url:'/api/investment_img',
                    value:{
                        b_id:'',
                        token:''
                    }
                },
                investmentRisk:{
                    url:'/api/investment_risk',
                    value:{
                        b_id:''
                    }
                },
                investmentDb:{
                    url:'/api/investment_db',
                    value:{
                        db_id:''
                    }
                },
                investmentInvest:{
                    url:'/api/investment_invest',
                    value:{
                        b_id:''
                    }
                },
                calculateInvest:{
                    url:'/api/calculateInvest',
                    value:{
                        token:'',
                        b_id:'',
                        amount:'',
                        CouponID:'',
                        type:''
                    },
                    beizhu:[
                        {line:'amount指投资总额，CouponID指礼券id，type指礼券类型'}
                    ]
                },
                getUccoupon:{
                    url:'/api/get_uccoupon',
                    value:{
                        token:'',
                        b_id:'',
                        amount:''
                    },
                },
                getReward:{
                    url:'/api/get_reward',
                    value:{
                        token:'',
                        b_id:'',
                        amount:''
                    }
                },
                tenderAction:{
                    url:'/api/tender_action',
                    value:{
                        token:'',
                        b_id:'',
                        Amount:'',
                        uic_id:'',
                        uc_id:'',
                        trader_password:''
                    }
                },
                investAgreement:{
                    url:'/api/invest_agreement',
                    beizhu:[{line:'使用contract/index/标号/1获取借款协议'}]
                },
                userCenter:{
                    url:'/api/user_center',
                    value:{
                        token:''
                    }
                },
                getResetPasswordSmsCode:{
                    url:'/api/get_reset_password_sms_code',
                    value:{
                        token:'',
                        phone:''
                    }
                },
                resetPassword:{
                    url:'/api/reset_password',
                    value:{
                        token:'',
                        old_password:'',
                        phone:'',
                        sms_code:'',
                        new_password:'',
                        new_password_confirm:''
                    }
                },
                setTradepwd:{
                    url:'/api/set_tradepwd',
                    value:{
                        token:'',
                        tradepwd:'',
                        tradepwd_confirm:''
                    }
                },
                getResetTradepwdSmsCode:{
                    url:'/api/get_reset_tradepwd_sms_code',
                    value:{
                        token:'',
                        phone:''
                    }
                },
                resetTradepwd:{
                    url:'/api/reset_tradepwd',
                    value:{
                        token:'',
                        password:'',
                        phone:'',
                        sms_code:'',
                        new_tradepwd:'',
                        new_tradepwd_confirm:''
                    }
                },
                certifyid:{
                    url:'/api/certifyid',
                    value:{
                        token:'',
                        newpw:'',
                        cfpw:'',
                        RealName:'',
                        IDNumber:''
                    },
                    beizhu:[{line:'IDNumber指身份证号码'}]
                },
                userStatus:{
                    url:'/api/user_status',
                    value:{
                        token:''
                    }
                },
                getModifyMobileSmsCodeOldphone:{
                    url:'/api/get_modify_mobile_sms_code_oldphone',
                    value:{
                        token:'',
                        phone:''
                    }
                },
                modifyMobileVerifyOldphone:{
                    url:'/api/modify_mobile_verify_oldphone',
                    value:{
                        token:'',
                        password:'',
                        phone:'',
                        sms_code:'',
                    }
                },
                getModifyMobileSmsCode:{
                    url:'/api/get_modify_mobile_sms_code',
                    value:{
                        token:'',
                        phone:''
                    }
                },
                modifyMobile:{
                    url:'/api/modify_mobile',
                    value:{
                        token:'',
                        phone:'',
                        sms_code:''
                    }
                },
                getBank:{
                    url:'/api/get_bank',

                },
                bankmg:{
                    url:'/api/bankmg',
                    value:{
                        token:''
                    }
                    
                },
                bankAction:{
                    url:'/api/bank_action',
                    value:{
                        token:'',
                        a_account_user:'',
                        a_account:'',
                        a_the_depositary_bank:'',
                        a_subbranch:''
                    },
                    beizhu:[{line:'开户人，银行账号，开户银行，开户支行'}]
                },
                changeBankUse:{
                    url:'/api/change_bank_use',
                    value:{
                        token:'',
                        a_id:''
                    },
                    beizhu:[{line:'a_id指添加的银行卡对应id'}]
                },
                deleteBank:{
                    url:'/api/delete_bank',
                    value:{
                        token:'',
                        a_id:''
                    }
                },
                reward:{
                    url:'/api/reward',
                    value:{
                        token:'',
                        type:'',
                        status:''
                    },
                    beizhu:[{line:'type:1->代金券，2->加息券，3->红包'},{line:'status:0->可用(在途)，1->已用(已发)，2->过期(失效)'}]
                },
                rewardDjqDetails:{
                    url:'/api/reward_djq_details',
                    value:{
                        token:'',
                        uc_id:''
                    }
                },
                rewardJxqDetails:{
                    url:'/api/reward_jxq_details',
                    value:{
                        token:'',
                        uic_id:''
                    }
                },
                rewardHbDetails:{
                    url:'/api/reward_hb_details',
                    value:{
                        token:'',
                        ur_id:''
                    }
                },
                fundrecord:{
                    url:'/api/fundrecord',
                    value:{
                        token:'',
                        data_type:'',
                        limit:'',
                        offset:'',
                        type:''
                    },
                    beizhu:[
                        {line:'data_type传1获取分类信息，type和data_type不传值获取全部信息'},
                        {line:'type：0投标1充值2提现3还款4转让5赎回6其他'}
                    ]
                },
                income:{
                    url:'/api/income',
                    value:{
                        token:'',
                        limit:'',
                        offset:''
                    }
                },
                msg:{
                    url:'/api/msg',
                    value:{
                        token:'',
                        limit:'',
                        offset:'',
                        s_time:'',
                        e_time:''
                    }
                },
                msgRead:{
                    url:'/api/msg_read',
                    value:{
                        token:'',
                        id:''
                    }
                },
                fcode:{
                    url:'/api/fcode',
                    value:{
                        token:''
                    }
                },
                fcodeUrl:{
                    url:'/api/fcode_url',
                    value:{
                        token:''
                    }
                },
                fcodeReward:{
                    url:'/api/fcode_reward',
                    value:{
                        token:''
                    }
                },
                fcodeFriend:{
                    url:'/api/fcode_friend',
                    value:{
                        token:''
                    }
                },
                repayment:{
                    url:'/api/repayment',
                    value:{
                        token:''
                    }
                },
                myinvest:{
                    url:'/api/myinvest',
                    value:{
                        token:'',
                        data_type:'',
                        limit:'',
                        offset:'',
                        b_status:''
                    },
                    beizhu:[{line:'b_status为空时返回全部投资1等待生效2正在回款3汇款完成'}]
                },
                myinvestDetails:{
                    url:'/api/myinvest_details',
                    value:{
                        token:'',
                        t_id:''
                    }
                },
                withdrawals:{
                    url:'/api/withdrawals',
                    value:{
                        token:''
                    }
                },
                withdrawalsAction:{
                    url:'/api/withdrawals_action',
                    value:{
                        token:'',
                        trader_password:'',
                        amount:'',
                        bankid:''
                    }
                },
                withdrawalsProcessing:{
                    url:'/api/withdrawals_processing',
                    value:{
                        token:''
                    }
                },
                withdrawalsCancel:{
                    url:'/api/withdrawals_cancel',
                    value:{
                        token:'',
                        w_id:'',
                        trader_password:''
                    }
                },
                charge:{
                    url:'/api/charge',
                    value:{
                        token:''
                    }
                },
                unionpay:{
                    url:'/api/unionpay',
                    value:{
                        token:'',
                        Amount:'',
                        trader_password:''
                    }
                },
                BackReceive:{
                    url:'/api/BackReceive',
                    beizhu:[{line:'未调试'}]
                },
                upgrade:{
                    url:'/api/upgrade',
                    beizhu:[{line:'未调试'}]
                },
                transferCondition:{
                    url:'/api/transfer_condition',
                },
                transfer:{
                    url:'/api/transfer',
                    value:{
                        limit:'',
                        offset:'',
                        bt_code:'',
                        pubtime:'',
                        rate:'',
                        t_status:'',
                        pub_sort:'',
                        rate_sort:''
                    }
                },
                transferDetails:{
                    url:'/api/transfer_details',
                    value:{
                        token:'',
                        tr_id:'',
                        b_id:'',
                        t_id:''
                    },
                    beizhu:[{'line':'tr_id 转让记录id，b_id 项目id，t_id 旧投资人投资id，t_tr_yutime 剩余时间e'}]
                },
                transferIntr:{
                    url:'/api/transfer_intr'
                },
                transferRepayment:{
                    url:'/api/transfer_repayment',
                    value:{
                        b_id:'',
                        tr_id:''
                    }
                },
                transferAction:{
                    url:'/api/transfer_action',
                    value:{
                        token:'',
                        tr_id:'',
                        b_id:'',
                        t_id:'',
                        t_tr_yutime:'',
                        trader_password:''
                    },
                    beizhu:[{'line':'tr_id 转让记录id，b_id 项目id，t_id 旧投资人投资id，t_tr_yutime 剩余时间'}]
                },
                investmentRepaymentplan:{
                    url:'/api/investment_repaymentplan',
                    value:{
                        b_id:''
                    }
                },
                mytransferAction:{
                    url:'/api/mytransfer_action',
                    value:{
                        token:'',
                        t_id:'',
                        transfer_money:'',
                        limitDay:'',
                        TransferTime:'',
                        trader_password:''
                    }
                },
                mytransfer:{
                    url:'/api/mytransfer',
                    value:{
                        token:'',
                        data_type:'',
                        limit:'',
                        offset:'',
                        t_transfer_type:'',
                        t_transfer_status:''
                    }
                },
                mytransferDetail:{
                    url:'/api/mytransfer_details',
                    value:{
                        token:'',
                        b_id:'',
                        t_id:''
                    }
                }
            }
        },
        components:{post},
        methods: {
        	post(url,api){
                const userAgentDefalut = '51jili';
                const appid = '06wygzvDdr062rNwIXTC';
                const appkey = 'vxCdATZ76WeqjhF3ZNHu';
                const appver = '2.6.0';
                const apptype = 'ios';

                if(api){
                    // 深拷贝一个副本,若不这样做，会把data也污染
                    var valuesObj = JSON.parse(JSON.stringify(this[api]));
                    console.log(valuesObj);
                    arr = [],
                    str = '',
                    hash;
                }else{
                    var valuesObj = {},
                    arr = [],
                    str = '',
                    hash;
                }

                // valuesObj.time = Date.parse(new Date());
                valuesObj.appver = appver;
                valuesObj.apptype = apptype;

                for(var item in valuesObj){
                  // php接受post的值若为空，则不接受这个键名，并且后台序列化加密的键名里面不出现
                  if(valuesObj[item]!=''){
                    var temp = item+':'+valuesObj[item];
                    arr.push(temp);
                  }
                }
                arr.sort();
                console.log(String(arr))
                for(var i of arr){
                  var index = i.indexOf(':');
                  var temp = i.slice(0,index)+'='+i.slice(index+1);
                  str += temp+'&';
                }
                str += 'appid='+appid+'&appkey='+appkey;
                console.log(str)

                hash = md5(str);
                valuesObj.sign = hash.toLocaleUpperCase();
                // var senddata = {};
                // if(api){
                //     senddata = this[api];
                // }
                // senddata.appver = appver;
                // senddata.apptype = apptype
                // senddata.sign = hash.toLocaleUpperCase();

                console.log(valuesObj)
				$.ajax({
                    url:url,
                    type:'post',
                    dataType:'json',
                    data:valuesObj,
                    success:function(data){
                        console.log(data)
                        console.log(JSON.stringify(data))
                    }
                })

        	},

        },

    }

</script>

<style lang="scss" scoped>
    .content{
        padding:10px;
    }
    .group{
        border:1px solid #000;
        padding:5px;
    }
    .backContent{
        background:#0c5ccb;
        color:#fff;
    }
</style>
